<div align="center" class="grosblanc">gestion du prix de l'article <?php echo '\''.$libarticle['0']['libelle'].'\''; ?></div>

<?php 
echo form_open('administration/articlePrix');?>
<div align="center" class="divrondform">
	<div style="margin-left:50px; margin-top:20px;">
		<table>
			<tr>
				<td>
					<table id="prixarticle_grid" style="cursor:pointer"></table>
				</td>
				<td valign="top" width="300px" style="margin:auto;">
					<input class="boutons" name="BPrix" id="BPrix" type="button" value="Nouveau prix" style="width:130 px" /><br><br>
					<input class="boutons" name="BPrix" id="BProlong" type="submit" value="Prolonger le prix" style="width:130 px" /><br><br>
					<input class="boutons" name="BPrix" id="Retour" type="submit" value="Retour" style="width:130 px" /><br><br>
				</td>	
			</tr>
		</table>
	</div>
	<div id="pager"></div>
	<?php echo $prixarticleGrille; ?>
	<br>
</div>    
</form>

<div id="majprix-form" title="Prolongation d'un prix">
	<?php echo form_open('administration/ProlongPrix', array('id' => 'prolongprixform'));?>
    <fieldset>
        <input type="hidden" name="idarticle" id="idarticle" value="<?php echo $this->session->userdata['id']; ?>"/>
         <span id="nomarticle"></span>
        <label for="pdate" id="l1" class="label-class">Date de d&éacute;but : </label>
        <input type="text" id="pdate" size="12" maxlength="12" class="text input-class" />
        <label for="pprix" id="l2" class="label-class">Nouveau prix :</label>
        <input type="text" id="pprix" size="12" maxlength="12" class="text input-class" />
    </fieldset>
    </form>
    <p class="validateTips"></p>
</div>


<script>
$(function() {
	var idarticle     = $("#idarticle"),
		pdate         = $("#pdate"),
		pprix         = $("#pprix"),
		allFields  = $([]).add(pdate).add(pprix),
		tips       = $(".validateTips"),
		textError  = "";

	$("#BPrix").click(function() {
		allFields.val("").removeClass("ui-state-error");
		updateTips("");
		$("#majprix-form").dialog("open");
	});
	
	$("#majprix-form").dialog({
		autoOpen: false,
		height: 'auto',
		width: 'auto',
		modal: true,
		resizable:false,
		open: function() {
			$("#l1").css('width', '400px');
			$("#l2").css('width', '400px');
		},
		buttons: {
			"Ajouter": function() {
        		var bValid = 0;
        		allFields.removeClass( "ui-state-error" );
        		textError = "";
	
        		updateTips(textError);
	
				if(bValid == 0) {
					mdp.val(mdp1.val());
					$("#majmdpform").submit();
        			$(this).dialog("close");
				}
     		},
     	
	     	"Fermer": function() {
        		$(this).dialog( "close" );
     		}
		},
	
		close: function() {
			allFields.val( "" ).removeClass( "ui-state-error" );
		},	
	});

	function updateTips( t ) {
	    tips
	    .html( t )
	    .addClass( "petitrouge" );
	}
});
</script>